package com.example.demo2022.controller;

import com.example.demo2022.common.web.WebResultJson;
import com.example.demo2022.entity.Role;
import com.example.demo2022.service.IRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/************************************
 * @PACKAGE : com.example.demo2022.controller
 * @Author    :  叫我老伯
 * @Date    : 2022/5/31 19:56
 * @Desc    :
 ***********************************/
/**
 * 用户- 角色分配
 * 1、回显当前用户已经拥有的角色信息
 * 2、修改 提交
 */
@RestController
@RequestMapping("/role")
public class RoleController {

    @Autowired
    private IRoleService roleService;

    @RequestMapping("/listRoleByUserId")
    public WebResultJson listRoleByUserId(Long userId){
        List<Role>  roleList = roleService.listRoleByUserId(userId);
        return WebResultJson.ok(roleList);
    }
}
